import Vue from 'vue'
import Vuex from 'vuex'
import menus from "@/store/modules/menus";
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token:null
  },
  mutations: {
    SET_TOKEN: (state,token)=>{
      //设置状态中的token为jwt
      state.token = token
      //本地储存jwt
      localStorage.setItem('token',token)
    },
  },
  actions: {
    setToken: ({commit},token)=>{
      commit("SET_TOKEN",token)
    },

  },
  modules: {
    menus,
  }
})
